home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Festival Card Factory
/
Festival Card Factory.iso
/
imagewin.~pa
< prev
next >
Wrap
Text File
|
1995-12-25
|
4KB
|
136 lines
unit ImageWin;
interface
uses WinTypes, WinProcs, Classes, Graphics, Forms, Controls,
FileCtrl, StdCtrls, ExtCtrls, Buttons, Spin,graphwin;
type
TImageForm = class(TForm)
DirectoryListBox1: TDirectoryListBox;
DriveComboBox1: TDriveComboBox;
PathLabel: TLabel;
FileEdit: TEdit;
UpDownGroup: TGroupBox;
SpeedButton1: TSpeedButton;
BitBtn1: TBitBtn;
DisabledGrp: TGroupBox;
SpeedButton2: TSpeedButton;
BitBtn2: TBitBtn;
Panel1: TPanel;
Image1: TImage;
FileListBox1: TFileListBox;
Label1: TLabel;
SpinEdit1: TSpinEdit;
Label2: TLabel;
ViewBtn: TBitBtn;
Bevel1: TBevel;
Bevel2: TBevel;
FilterComboBox1: TFilterComboBox;
CheckBox1: TCheckBox;
StretchCheck: TCheckBox;
Button1: TButton;
Button2: TButton;
Bevel3: TBevel;
procedure FileListBox1Click(Sender: TObject);
procedure SpinEdit1Change(Sender: TObject);
procedure ViewBtnClick(Sender: TObject);
procedure ViewAsGlyph(const FileExt: string);
procedure CheckBox1Click(Sender: TObject);
procedure StretchCheckClick(Sender: TObject);
procedure FileEditKeyPress(Sender: TObject; var Key: Char);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
end;
var
ImageForm: TImageForm;
cmd:array[0..255] of char;
implementation
uses ViewWin, SysUtils;
{$R *.DFM}
procedure TImageForm.FileListBox1Click(Sender: TObject);
var
FileExt: string[4];
begin
FileExt := UpperCase(ExtractFileExt(FileListBox1.Filename));
if (FileExt = '.BMP') or (FileExt = '.ICO') or (FileExt = '.WMF') then
begin
Image1.Picture.LoadFromFile(FileListBox1.Filename);
Label1.Caption := ExtractFilename(FileListBox1.Filename);
if (FileExt = '.BMP') then
begin
Label1.Caption := Label1.Caption +
Format(' (%d x %d)', [Image1.Picture.Height, Image1.Picture.Width]);
ViewForm.Image1.Picture := Image1.Picture;
ViewAsGlyph(FileExt);
end;
if FileExt = '.ICO' then Icon := Image1.Picture.Icon;
if FileExt = '.WMF' then
ViewForm.Image1.Picture.Metafile := Image1.Picture.Metafile;
end;
end;
procedure TImageForm.CheckBox1Click(Sender: TObject);
begin
ViewAsGlyph(UpperCase(ExtractFileExt(FileListBox1.Filename)));
end;
procedure TImageForm.ViewAsGlyph(const FileExt: string);
begin
if CheckBox1.Checked and (FileExt = '.BMP') then
begin
SpeedButton1.Glyph := Image1.Picture.Bitmap;
SpeedButton2.Glyph := Image1.Picture.Bitmap;
SpinEdit1.Value := SpeedButton1.NumGlyphs;
BitBtn1.Glyph := Image1.Picture.Bitmap;
BitBtn2.Glyph := Image1.Picture.Bitmap;
end;
end;
procedure TImageForm.ViewBtnClick(Sender: TObject);
begin
ViewForm.HorzScrollBar.Range := Image1.Picture.Width;
ViewForm.VertScrollBar.Range := Image1.Picture.Height;
ViewForm.Caption := Label1.Caption;
ViewForm.Show;
end;
procedure TImageForm.SpinEdit1Change(Sender: TObject);
begin
SpeedButton1.NumGlyphs := SpinEdit1.Value;
SpeedButton2.NumGlyphs := SpinEdit1.Value;
end;
procedure TImageForm.StretchCheckClick(Sender: TObject);
begin
Image1.Stretch := StretchCheck.Checked;
end;
procedure TImageForm.FileEditKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
FileListBox1.ApplyFilePath(FileEdit.Text);
Key := #0;
end;
end;
procedure TImageForm.Button1Click(Sender: TObject);
begin
form1.show;
end;
procedure TImageForm.Button2Click(Sender: TObject);
begin
strpcopy(cmd, 'c:\windows\calc.exe');
winExec(cmd, sw_showmaximized);
end;
end.